package cate.game.activity.continuousrecharge.msg;

import cate.common.table.d.GDFunc;
import cate.game.GameBody;
import cate.game.activity.continuousrecharge.ContinuousRechargeActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBActivity;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "连续充值-领取累计及奖励 请求")
public class ContinuousRechargeGetAddUpRewardReq implements MsgInput {
    @NoteField("档位")
    public int level;

    @Override
    public MsgConfig conf() {
        return MsgIdBActivity.ACT_CONTINUOUS_RECHARGE_GET_ADD_UP_REWARD_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        ContinuousRechargeActivity single = cc.getRole().getActivity().getEnableActivitySingle(GDFunc.ACT_CONTINUOUS_RECHARGE);
        if (single == null) {
            return;
        }
        EcResult<ContinuousRechargeActivity> r = single.onGetPrivilegeReward(level);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        } else {
            r.data.noticeUpdate();
        }
    }
}
